#ifndef __DKGL_GRID_H__
#define __DKGL_GRID_H__

//#include "dkglString.h"
#include "dkglMesh.h"

namespace DKGL
{
    namespace primitive
    {
        class Grid : public Mesh
        {
        public:

            Grid(const String&, float width, float height, int width_seg, int height_seg);

            virtual ~Grid();

			virtual void setMaterial(int, MaterialPtr matPtr);

        protected:
            
            void renderImpl();

            void allocBuf();

            void initVertexBuf();

            void initIndexBuf();

            void genDisplayList();

			virtual bounding::Bounding* _constructBounding()
			{
				return NULL;
			}

			virtual void _deconstructBounding(bounding::Bounding*)
			{
			
			}

        private:

            unsigned int* _indexBuf;

            float   _width;
            float   _height;
            int     _width_segments;
            int     _height_segments;
            int     _displayListId;

			MaterialPtr _materialPtr;
        };
    }
}

#endif